/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EJEMPLOSawt;

import java.awt.Button;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 *
 * @author pueblax
 */
public class ejercicio57botones {

    public static void main(String args[]) {
        Frame f = new Frame();
        FlowLayout flo = new FlowLayout();//acomoda distancia uno en otro de izquierda a derecha

        f.addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });


        //f.setLayout(new FlowLayout());
//f.setLayout(flo);
//flo.setHgap(50);//setHgap son pixeseles
//flo.setAlignment(FlowLayout.RIGHT);

        f.setBackground(Color.red);
        Panel p0 = new Panel();
        Panel p = new Panel();
        Panel p1 = new Panel();
        Panel p2 = new Panel();
        Panel p3 = new Panel();
        Panel p4 = new Panel();
        Panel p5 = new Panel();
        Panel p6 = new Panel();
        Panel p7 = new Panel();
        Panel p8 = new Panel();
        Panel p9 = new Panel();
        Panel p10 = new Panel();
        Panel p11 = new Panel();
        Panel p12 = new Panel();
        Panel p13 = new Panel();
        Panel p14 = new Panel();
        Panel p15 = new Panel();
        Panel p16 = new Panel();


        Panel p131 = new Panel();
        Panel p132 = new Panel();
        Panel p133 = new Panel();

        Panel p141 = new Panel();
        Panel p142 = new Panel();
        Panel p143 = new Panel();


        Button b1 = new Button("1");
        Button b2 = new Button("2");
        Button b3 = new Button("3");
        Button b4 = new Button("4");
        Button b5 = new Button("5");
        Button b6 = new Button("6");
        Button b7 = new Button("7");


        Button b8 = new Button("8");
        Button b9 = new Button("9");
        Button b10 = new Button("10");
        Button b11 = new Button("11");
        Button b12 = new Button("12");
        Button b13 = new Button("13");
        Button b14 = new Button("14");


        Button b15 = new Button("15");
        Button b16 = new Button("16");
        Button b17 = new Button("17");
        Button b18 = new Button("18");
        Button b19 = new Button("19");
        Button b20 = new Button("20");
        Button b21 = new Button("21");


        Button b22 = new Button("22");
        Button b23 = new Button("23");
        Button b24 = new Button("24");
        Button b25 = new Button("25");


        Button b26 = new Button("26");
        Button b27 = new Button("27");
        Button b28 = new Button("28");
        Button b29 = new Button("29");

        Button b30 = new Button("30");
        Button b31 = new Button("31");
        Button b32 = new Button("32");
        Button b33 = new Button("33");

        Button b34 = new Button("34");
        Button b35 = new Button("35");
        Button b36 = new Button("36");
        Button b37 = new Button("37");

        Button b38 = new Button("38");
        Button b39 = new Button("39");
        Button b40 = new Button("40");
        Button b41 = new Button("41");

        Button b42 = new Button("42");
        Button b43 = new Button("43");
        Button b44 = new Button("44");
        Button b45 = new Button("45");

        Button b46 = new Button("46");
        Button b47 = new Button("47");
        Button b48 = new Button("48");
        Button b49 = new Button("49");

        Button b50 = new Button("50");
        Button b51 = new Button("51");
        Button b52 = new Button("52");
        Button b53 = new Button("53");

        Button b54 = new Button("54");
        Button b55 = new Button("55");
        Button b56 = new Button("56");
        Button b57 = new Button("57");
        Button b58 = new Button("58");

        f.setLayout(new GridLayout(4, 4));///pone columna y filas

        f.add(p);
        p.setBackground(Color.BLUE);
        p.setLayout(new GridLayout(2, 2));///pone columna y filas
        p.add(b1);
        p.add(b2);
        p.add(b3);
        p.add(b4);

        f.add(p1);
        p1.setBackground(Color.gray);
        p1.setLayout(new GridLayout(2, 0));///pone columna y filas
        p1.add(b5);
        p1.add(b6);


        f.add(p2);
        p2.setBackground(Color.BLUE);
        p2.add(b9);
        p2.setLayout(new GridLayout(3, 0));///pone columna y filas
        p2.add(b7);
        p2.add(b8);
        p2.add(b9);

        f.add(p3);
        p3.setBackground(Color.DARK_GRAY);
        p3.setLayout(new GridLayout(2, 2));///pone columna y filas
        p3.add(b10);
        p3.add(b11);
        p3.add(b12);
        p3.add(b13);

        f.add(p4);
        p4.setBackground(Color.CYAN);
        p4.setLayout(new GridLayout(3, 0));///pone columna y filas
        p4.add(b14);
        p4.add(b15);
        p4.add(b16);

        f.add(p5);
        p5.setBackground(Color.GREEN);
        p5.setLayout(new GridLayout(0, 4));///pone columna y filas
        p5.add(b17);
        p5.add(b18);
        p5.add(b19);
        p5.add(b20);

        f.add(p6);
        p6.setBackground(Color.LIGHT_GRAY);
        p6.setLayout(new GridLayout(0, 4));///pone columna y filas
        p6.add(b21);
        p6.add(b22);
        p6.add(b23);
        p6.add(b24);

        f.add(p7);
        p7.setBackground(Color.MAGENTA);
        p7.setLayout(new GridLayout(3, 0));///pone columna y filas
        p7.add(b25);
        p7.add(b26);
        p7.add(b27);

        f.add(p8);
        p8.setBackground(Color.ORANGE);
        p8.setLayout(new GridLayout(0, 2));///pone columna y filas
        p8.add(b28);
        p8.add(b29);

        f.add(p9);
        p9.setBackground(Color.PINK);
        p9.setLayout(new GridLayout(3, 0));///pone columna y filas
        p9.add(b30);
        p9.add(b31);
        p9.add(b32);

        f.add(p10);
        p10.setBackground(Color.YELLOW);
        p10.setLayout(new GridLayout(3, 0));///pone columna y filas
        p10.add(b33);
        p10.add(b34);
        p10.add(b35);

        f.add(p11);
        p11.setBackground(Color.WHITE);
        p11.setLayout(new GridLayout(0, 2));///pone columna y filas
        p11.add(b36);
        p11.add(b37);


        f.add(p12);
        p12.setBackground(Color.black);
        p12.setLayout(new GridLayout(0, 2));///pone columna y filas
        p12.add(b38);
        p12.add(b39);

        f.add(p13);
        p13.setBackground(Color.BLUE);
        p13.setLayout(new GridLayout(3, 0));///pone columna y filas

        p13.add(p131);
        p131.setLayout(new GridLayout(0, 3));///pone columna y filas
        p131.add(b40);
        p131.add(b41);
        p131.add(b42);

        p13.add(p132);
        p132.setLayout(new GridLayout(0, 2));///pone columna y filas
        p132.add(b43);
        p132.add(b44);

        p13.add(p133);
        p133.setLayout(new GridLayout(0, 3));///pone columna y filas
        p133.add(b45);
        p133.add(b46);
        p133.add(b47);


        p131.setBackground(Color.black);
        p132.setBackground(Color.ORANGE);
        p133.setBackground(Color.GRAY);

        f.add(p14);
        p14.setBackground(Color.BLUE);
        p14.setLayout(new GridLayout(3, 0));///pone columna y filas

        p14.add(p141);
 p141.setLayout(new GridLayout(0, 3));///pone columna y filas
        p141.add(b48);
        p141.add(b49);
        p141.add(b50);

        p14.add(p142);
            p142.setLayout(new GridLayout(0, 2));///pone columna y filas
        p142.add(b51);
        p142.add(b52);

        p14.add(p143);
 p143.setLayout(new GridLayout(0, 3));///pone columna y filas
        p143.add(b53);
        p143.add(b54);
        p143.add(b55);

        p141.setBackground(Color.GRAY);
        p142.setBackground(Color.GREEN);
        p143.setBackground(Color.blue);

        f.add(p15);
        p15.setBackground(Color.MAGENTA);
        p15.setLayout(new GridLayout(0, 2));///pone columna y filas
        p15.add(b56);
        p15.add(b57);

//f.setLocation(500, 400);
        f.setVisible(true);
        f.setSize(600, 600);


        //System.exit(0);


    }
}
